package cn.edu.imau.zy.student.service.impl;

import java.util.List;

import cn.edu.imau.zy.common.utils.DateUtils;
import cn.edu.imau.zy.student.mapper.StStudentPoorMapper;
import cn.edu.imau.zy.student.service.IStStudentPoorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.edu.imau.zy.common.core.entity.student.StStudentPoor;
import cn.edu.imau.zy.common.core.text.Convert;

/**
 * 贫困信息Service业务层处理
 *
 * @author Wyz
 * @date 2020-10-16
 */
@Service
public class StStudentPoorServiceImpl implements IStStudentPoorService {
    @Autowired
    private StStudentPoorMapper stStudentPoorMapper;

    /**
     * 查询贫困信息
     *
     * @param id 贫困信息ID
     * @return 贫困信息
     */
    @Override
    public StStudentPoor selectStStudentPoorById(String id) {
        return stStudentPoorMapper.selectStStudentPoorById(id);
    }

    /**
     * 查询贫困信息列表
     *
     * @param stStudentPoor 贫困信息
     * @return 贫困信息
     */
    @Override
    public List<StStudentPoor> selectStStudentPoorList(StStudentPoor stStudentPoor) {
        return stStudentPoorMapper.selectStStudentPoorList(stStudentPoor);
    }

    /**
     * 新增贫困信息
     *
     * @param stStudentPoor 贫困信息
     * @return 结果
     */
    @Override
    public int insertStStudentPoor(StStudentPoor stStudentPoor) {
        stStudentPoor.setCreateTime(DateUtils.getNowDate());
        return stStudentPoorMapper.insertStStudentPoor(stStudentPoor);
    }

    /**
     * 修改贫困信息
     *
     * @param stStudentPoor 贫困信息
     * @return 结果
     */
    @Override
    public int updateStStudentPoor(StStudentPoor stStudentPoor) {
        stStudentPoor.setUpdateTime(DateUtils.getNowDate());
        return stStudentPoorMapper.updateStStudentPoor(stStudentPoor);
    }

    /**
     * 删除贫困信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStStudentPoorByIds(String ids) {
        return stStudentPoorMapper.deleteStStudentPoorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除贫困信息信息
     *
     * @param studentId 贫困信息ID
     * @return 结果
     */
    @Override
    public int deleteStStudentPoorById(String studentId) {
        return stStudentPoorMapper.deleteStStudentPoorById(studentId);
    }

    @Override
    public StStudentPoor selectStStudentPoor(StStudentPoor studentPoor) {
        return stStudentPoorMapper.selectStStudentPoor(studentPoor);
    }
}
